package com.opgea.crm.web.form;

import com.opgea.crm.common.util.DateUtil;
import com.opgea.crm.domain.entities.ProjectDetails;

public class ProjectDetailsForm {
	
	private Long projectId;
	private Long leadId;
	private String projectName;
	private String companyCustomer;
	private String projectDetails;
	private String actualStartDate;
	private String actualEndDate;
	private String actualBudget;
	private String actualHrs;
	private String projectSearchCriteria; 
	private String criteriaValue;
	
	
	//combos
	
	private String contactTo;
	private long contactToId;
	private String status;
	private long statusId;
	private String priority;
	private long priorityId;
	
	
	public Long getProjectId() {
		return projectId;
	}
	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}
	
	
	public Long getLeadId() {
		return leadId;
	}
	public void setLeadId(Long leadId) {
		this.leadId = leadId;
	}
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	public String getCompanyCustomer() {
		return companyCustomer;
	}
	public void setCompanyCustomer(String companyCustomer) {
		this.companyCustomer = companyCustomer;
	}
	public String getContactTo() {
		return contactTo;
	}
	public void setContactTo(String contactTo) {
		this.contactTo = contactTo;
	}
	public String getProjectDetails() {
		return projectDetails;
	}
	public void setProjectDetails(String projectDetails) {
		this.projectDetails = projectDetails;
	}
	
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public long getStatusId() {
		return statusId;
	}
	public void setStatusId(long statusId) {
		this.statusId = statusId;
	}
	public String getPriority() {
		return priority;
	}
	public void setPriority(String priority) {
		this.priority = priority;
	}
	public long getPriorityId() {
		return priorityId;
	}
	public void setPriorityId(long priorityId) {
		this.priorityId = priorityId;
	}
	public String getActualStartDate() {
		return actualStartDate;
	}
	public void setActualStartDate(String actualStartDate) {
		this.actualStartDate = actualStartDate;
	}
	public String getActualEndDate() {
		return actualEndDate;
	}
	public void setActualEndDate(String actualEndDate) {
		this.actualEndDate = actualEndDate;
	}
	public String getActualBudget() {
		return actualBudget;
	}
	public void setActualBudget(String actualBudget) {
		this.actualBudget = actualBudget;
	}
	public String getActualHrs() {
		return actualHrs;
	}
	public void setActualHrs(String actualHrs) {
		this.actualHrs = actualHrs;
	}
	public long getContactToId() {
		return contactToId;
	}
	public void setContactToId(long contactToId) {
		this.contactToId = contactToId;
	}
	
	public String getProjectSearchCriteria() {
		return projectSearchCriteria;
	}
	public void setProjectSearchCriteria(String projectSearchCriteria) {
		this.projectSearchCriteria = projectSearchCriteria;
	}
	public String getCriteriaValue() {
		return criteriaValue;
	}
	public void setCriteriaValue(String criteriaValue) {
		this.criteriaValue = criteriaValue;
	}
	
	
	public ProjectDetailsForm(){}
	
	public ProjectDetailsForm(ProjectDetails projectDetails)
	{
		this.setProjectId(projectDetails.getId());
		this.setProjectName(projectDetails.getProjectName());
		
		if(projectDetails.getStatus()!=null)
		{
			this.setStatus(projectDetails.getStatus().getFieldValue());
		    this.setStatusId(projectDetails.getStatus().getId());
		}
	    if(projectDetails.getCustomer()!=null)
	    this.setLeadId(projectDetails.getCustomer().getId());
	    
	    if(projectDetails.getCustomer()!=null)
	    this.setCompanyCustomer(projectDetails.getCustomer().getCompany().getName());
	    
	    if(projectDetails.getContactTo()!=null)
	    {
	    	this.setContactTo(projectDetails.getContactTo().getFirstName());
	    	this.setContactToId(projectDetails.getContactTo().getId());
	    }
	    if(projectDetails.getPriority()!=null)
	    {
	    	this.setPriority(projectDetails.getPriority().getFieldValue());
	    	this.setPriorityId(projectDetails.getPriority().getId());
	    }
	    this.setActualStartDate(DateUtil.dateToString(projectDetails.getActualStartDate()));
	    this.setActualEndDate(DateUtil.dateToString(projectDetails.getActualEndDate()));
	    this.setActualBudget(projectDetails.getActualBudget().toString());
	    this.setActualHrs(projectDetails.getActualTakenHrs().toString());
	    String details = new String(projectDetails.getProjectDetails());
	    this.setProjectDetails(details);
	}
	
	
	
	
}
